package com.logistics.heart.entity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.logistics.heart.entity.model.HeartSave;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author zhiyu.fan
 * @since 2024-06-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("lgs_heart")
public class Heart implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private String ip;

    private String connectState;

    private String handleState;

    private Integer battery;

    private BigDecimal x;

    private BigDecimal y;

    private BigDecimal yaw;

    private String stage;

    private BigDecimal forkHeight;

    private String agvName;

    private String moveState;

    private String taskState;

    private String state;

    private String path;

    private Date createTime;

    public Heart(){}

    public Heart(HeartSave save){
        this.ip = save.getIp();
        this.connectState = save.getConnectState();
        this.handleState = save.getHandleState();
        this.battery = save.getBattery();
        this.x = save.getX();
        this.y = save.getY();
        this.yaw = save.getYaw();
        this.stage = save.getStage();
        this.forkHeight = save.getForkHeight();
        this.agvName = save.getAgvName();
        this.moveState = save.getMoveState();
        this.taskState = save.getState();
        this.path = save.getPath();
        this.createTime = save.getCreateTime();
    }

    public static Heart build(HeartSave save){
        return new Heart(save);
    }

    public static Heart build(String state){
        Heart heart = new Heart();
        heart.setState(state);
        return heart;
    }

}
